<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
		<title>Gears Sample - module WorkerPool </title>
		<script type="text/javascript" src="gears_init.js"></script>
		<script type="text/javascript">
			function init() {
				if (!window.google || !google.gears) {
					alert("Install Gears");
				}
				var permission = google.gears.factory.getPermission("WebDb by Q", "../images/webdb.png");
				if (!permission) {
					alert("No permission");
				}
				
				var out = document.getElementById("output");
				var workerPool = google.gears.factory.create('beta.workerpool');
				workerPool.onmessage = function(a, b, message) {
					out.innerHTML = 'Worker #' + message.sender + ': ' + message.body[0] + '! = ' + message.body[1];
				};
				var childWorkerId = workerPool.createWorkerFromUrl('worker.js');
				workerPool.sendMessage(5, childWorkerId);
			}
		</script>
	</head>
	<body onload="init()">
		<div id="output"></div>
	</body>
</html>
